// 导入二次封装后的axios
import http from "./http.js";

import clientDetails from "./clientDetails.js";
import indexW from "./index-w.js";
import template from './template'
import client from "./client";
import listener from "./listener.js";
import group from "./group.js";
import plugin from "./plugin.js";
import resource from "./resource.js";
import role from "./role.js";
import dept from "./dept.js";
import cache from "./cache.js";
import subscribe from "./subscribe.js";
import topic from "./topic.js";
import menu from "./menu.js";



// 向给定ID的用户发起请求
const login = function login(logindata) {
  return http.post("/login", logindata)
}

// 获取验证码
const getVerificationCode = () => {
  return http.get("/captchaImage")
}
// 用户注册
const register = (bindId = '', code, confirmPassword, password, phonenumber, username, uuid) => {
  return http.post('/iot/tool/register', {
    bindId,
    code,
    confirmPassword,
    password,
    phonenumber,
    username,
    uuid
  })
}
// 获取用户标识控制权限（gotInfo）
const getInfo = () => {
  return http.get('/getInfo')
}

// 获取列表数据
const getTemplateList = function getTemplateList(getlist) {
  return http.get("/iot/template/list", getlist)
}

// 获取产品分类
const getCategory = function getCategory(getlist) {
  return http.get('/iot/category/list', {
    pageNum: 1,
    pageSize: 20
  })
}

export default {
  login,
  register,
  getVerificationCode,
  getInfo,
  getTemplateList,
  getCategory,

  clientDetails, //云云对接
  indexW, //首页
  template, //通用物
  client, //客户端
  listener, //监听器
  group,
  plugin,
  resource,
  role,
  dept,//部门管理
  cache,//缓存监控
  subscribe, //消息订阅
  topic,//消息主题
  menu,//菜单管理
}